package com.xgc.book.bookserver.controller;


import com.xgc.book.bookserver.bean.FeedbackBean;
import com.xgc.book.bookserver.service.FeedbackService;
import com.xgc.book.bookserver.util.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 意见反馈表 前端控制器
 * </p>
 *
 * @author wrz
 * @since 2023-11-20
 */
@RestController
@RequestMapping("/feedback")
public class FeedbackController {
    @Autowired
    private FeedbackService feedbackService;

    @GetMapping("/page")
    public ResultJson page(int page, int limit, FeedbackBean feedbackBean) {
        return feedbackService.getPage(page, limit, feedbackBean);
    }

    @PostMapping("/reply")
    public ResultJson reply(@RequestBody FeedbackBean feedbackBean) {
        feedbackService.updateById(feedbackBean);
        return ResultJson.ok();
    }

    @DeleteMapping("/delete/{id}")
    public ResultJson delete(@PathVariable int id) {
        feedbackService.removeById(id);
        return ResultJson.ok();
    }
}

